const express = require('express');
const ProductController = require('../../controller/admin/ProductController');
var ProductRouter = express.Router();
const multer = require('multer');
//尽量放在静态文件夹下  public/productuploads/ 静态目录下自动生成
const upload = multer({ dest: 'public/productuploads/' });
//新建资源
ProductRouter.post('/adminapi/product/add', upload.single('file'), ProductController.add);
//获取对应作者的资源
ProductRouter.get('/adminapi/product/list/:aid', ProductController.getList);
//删除资源
ProductRouter.delete('/adminapi/product/list/:uid', ProductController.delList);
//根据资源id获取资源
ProductRouter.get('/adminapi/product/list/user/:id', ProductController.getListByID);
//编辑更新资源
ProductRouter.post('/adminapi/product/list/:oid', upload.single('file'), ProductController.updateList);
module.exports = ProductRouter;
